package org.carabiner.infinitest;

import javax.swing.SwingUtilities;

public class EventNormalizer implements TestStatusListener
{
  private TestStatusListener listener;

  public EventNormalizer(TestStatusListener statusListener)
  {
    listener = statusListener;
  }
  
  public void testCaseSucceeded(final TestEvent event)
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        listener.testCaseSucceeded(event);        
      }      
    });
  }

  public void testError(final TestEvent event)
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        listener.testError(event);        
      }      
    });
  }

  public void testFailed(final TestEvent event)
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        listener.testError(event);        
      }      
    });
  }

  public void testMethodSucceeded(final TestEvent event)
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        listener.testMethodSucceeded(event);        
      }      
    });
  }

}
